want to know how to set below capabilities of chrome in javascript. I know Java and python but want in javascript.
Javascript : Chrome capabilities
python code
options = webdriver.ChromeOptions()
options.add_experimental_option('prefs', {
"download.default_directory": "C:/Users/517/Download", #Change default directory for downloads
"download.prompt_for_download": False, #To auto download the file
"download.directory_upgrade": True,
"plugins.always_open_pdf_externally": True #It will not show PDF directly in chrome
})
driver = webdriver.Chrome(options=options)
If possible provide link where I can refer for javascript.
Based on this api-docs, I am able to set capabilities in Javascript except default download path. However, same can be achieved by await wdriver.setDownloadPath('C:\\Downloads');
var chrome = require("selenium-webdriver/chrome");
let downloadFilepath = "C:\\Downloads";
let options = await new chrome.Options();
options.addArguments("--disable-dev-shm-usage");
options.addArguments('--ignore-certificate-errors');
options.addArguments('--ignore-ssl-errors');
options.setUserPreferences({'download.default_directory': "C:\\Downloads"});
options.setUserPreferences({'download.prompt_for_download': false});
options.setUserPreferences({'download.directory_upgrade': true});
options.setUserPreferences({'plugins.always_open_pdf_externally': true});
driver = await chrome.Driver.createSession(options);
Let me know if "download.default_directory" can be set using capabilities instead of wdriver.setDownloadPath.